﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BomberManServer.Gaming.Object.Mapping.Items
{
    public abstract class Bonus : Item
    {
        public Type type {get; private set;}
        public Game game { get; private set; }

        public Bonus(Game game,Type type)
        {
            this.game = game;
            this.type = type;
            this.destructible = true;
            this.free = true;
        }

        // bonus are destroyed by deflagration
        public override Item actionDeflagration(Deflagration deflagration)
        {
            game.sender.onBlockDestroyed(deflagration.coord);
            return Items.None.instance;
        }

        public override void actionWalk(Mapping.Block block, Items.Avatar avatar)
        {
            game.sender.onBonusTaken(block.coordinates);
            base.actionWalk(block, avatar);
            this.attach(avatar);
        }

        public abstract void attach(Avatar avatar);

        // always put SIZE as the last value
        public enum Type { SPEED, BOMB, DELAY, RANGE, KICK, SIZE };
    }
}
